﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using MpSoft.Library.BUSS.Contents;
using MpSoft.Library.BUSS.Categories;
using MpSoft.Basic.Utils;


namespace MpSoft.Web.Controls.News
{
    public partial class SearchNewsControl : System.Web.UI.UserControl
    {
        #region Var

        private string Title = string.Empty;
        private string CategorySeName = string.Empty;

        #endregion

        #region Method

        private void News()
        {
            var keysearch = Session["newsKeyword"];
            if (keysearch != null)
            {
                var list = NewsBUSS.News_Search(keysearch.ToString().Replace("-", " "), 1);
                rpNews.DataSource = list;
                rpNews.DataBind();
            }
            else {
                var list = NewsBUSS.News_Search(Title, 1);
                rpNews.DataSource = list;
                rpNews.DataBind();
            }

        }

        #endregion

        #region Event

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["Title"] != null)
                Title = Request.QueryString["Title"].ToString();
            if (Request.QueryString["CategoryCode"] != null)
                CategorySeName = Request.QueryString["CategoryCode"].ToString();
            News();
        }

        #endregion

        #region Properties
        #endregion
    }
}